


use "./Data/Chiang_Kuo_JJPS_ReplicationData.dta", clear

set scheme white_tableau
graph set window fontface "Arial"


/* Table 2 */

summ medigen_first medigen_booster /// // dependent variables 
     gov_trust /// // moderator
     dpp kmt other_party strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party medigen_before /// // independent variables
     populism unification flu_vax noshot_1 noshot_2 noshot_3 education family_income male age /// // control variables
     i.county // county fixed effect 

// ssc install asdoc
asdoc summ medigen_first medigen_booster ///
      gov_trust ///
      dpp kmt other_party strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party medigen_before ///
      populism unification flu_vax noshot_1 noshot_2 noshot_3 education family_income male age i.county, ///
      label fmt(%9.3f) save(./Out/Table_2.doc) title(Summary Statistics) replace




/* Table 3 & Appendix B: Table B1 */
reg medigen_first dpp#c.gov_trust kmt#c.gov_trust other_party#c.gov_trust dpp kmt other_party gov_trust, vce(robust)
eststo t3_1
estadd scalar ar2 = e(r2_a)
estadd local countyfe "No", replace

reg medigen_first dpp#c.gov_trust kmt#c.gov_trust other_party#c.gov_trust dpp kmt other_party gov_trust unification populism flu_vax noshot_1 male age education family_income i.county, vce(robust)
eststo t3_2
estadd scalar ar2 = e(r2_a)
estadd local countyfe "Yes", replace

reg medigen_first strong_dpp#c.gov_trust weak_dpp#c.gov_trust strong_kmt#c.gov_trust weak_kmt#c.gov_trust strong_other_party#c.gov_trust weak_other_party#c.gov_trust strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party c.gov_trust, vce(robust)
eststo t3_3
estadd scalar ar2 = e(r2_a)
estadd local countyfe "No", replace

reg medigen_first strong_dpp#c.gov_trust weak_dpp#c.gov_trust strong_kmt#c.gov_trust weak_kmt#c.gov_trust strong_other_party#c.gov_trust weak_other_party#c.gov_trust strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party c.gov_trust unification populism flu_vax noshot_1 male age education family_income i.county, vce(robust)
eststo t3_4
estadd scalar ar2 = e(r2_a)
estadd local countyfe "Yes", replace

esttab t3_1 t3_2 t3_3 t3_4 using "./Out/Table_3.html", ///
 b(%6.3f) se(%6.3f) nobaselevels star(* 0.1 ** 0.05 *** 0.01) ///
 eqlabels(" " " ") ///
 coeflab(1.dpp#c.gov_trust "DPP * Gov Trust" 1.kmt#c.gov_trust "KMT * Gov Trust" 1.other_party#c.gov_trust "Other Party * Gov Trust" 1.strong_dpp#c.gov_trust "Strong DPP * Gov Trust" 1.weak_dpp#c.gov_trust "Weak DPP * Gov Trust" 1.strong_kmt#c.gov_trust "Strong KMT * Gov Trust" 1.weak_kmt#c.gov_trust "Weak KMT * Gov Trust" 1.strong_other_party#c.gov_trust "Strong Other Party * Gov Trust" 1.weak_other_party#c.gov_trust "Weak Other Party * Gov Trust" _cons "Intercept") ///
 order(1.dpp#c.gov_trust 1.kmt#c.gov_trust 1.other_party#c.gov_trust 1.strong_dpp#c.gov_trust 1.weak_dpp#c.gov_trust 1.strong_kmt#c.gov_trust 1.weak_kmt#c.gov_trust 1.strong_other_party#c.gov_trust 1.weak_other_party#c.gov_trust dpp kmt other_party strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party gov_trust unification populism flu_vax noshot_1 male age education family_income) ///
 s(countyfe N ar2, fmt("%9.0g" "%9.0f" "%6.3f") label("County FE" "Observations" "Adjusted-R2")) /// 
 drop(*.county) ///
 label compress replace

est clear





/* Table 4 & Appendix B: Table B2 */
reg medigen_booster medigen_before#c.gov_trust dpp#c.gov_trust kmt#c.gov_trust other_party#c.gov_trust dpp kmt other_party medigen_before c.gov_trust, vce(robust)
eststo t4_1
estadd scalar ar2 = e(r2_a)
estadd local countyfe "No", replace

reg medigen_booster medigen_before#c.gov_trust dpp#c.gov_trust kmt#c.gov_trust other_party#c.gov_trust dpp kmt other_party medigen_before c.gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
eststo t4_2
estadd scalar ar2 = e(r2_a)
estadd local countyfe "Yes", replace

reg medigen_booster medigen_before#c.gov_trust strong_dpp#c.gov_trust weak_dpp#c.gov_trust strong_kmt#c.gov_trust weak_kmt#c.gov_trust strong_other_party#c.gov_trust weak_other_party#c.gov_trust strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party medigen_before c.gov_trust, vce(robust)
eststo t4_3
estadd scalar ar2 = e(r2_a)
estadd local countyfe "No", replace

reg medigen_booster medigen_before#c.gov_trust strong_dpp#c.gov_trust weak_dpp#c.gov_trust strong_kmt#c.gov_trust weak_kmt#c.gov_trust strong_other_party#c.gov_trust weak_other_party#c.gov_trust strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party medigen_before c.gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
eststo t4_4
estadd scalar ar2 = e(r2_a)
estadd local countyfe "Yes", replace

esttab t4_1 t4_2 t4_3 t4_4 using "./Out/Table_4.html", ///
 b(%6.3f) se(%6.3f) nobaselevels star(* 0.1 ** 0.05 *** 0.01) ///
 eqlabels(" " " ") ///
 coeflab(1.medigen_before#c.gov_trust "Medigen Before * Gov Trust" 1.dpp#c.gov_trust "DPP * Gov Trust" 1.kmt#c.gov_trust "KMT * Gov Trust" 1.other_party#c.gov_trust "Other Party * Gov Trust" 1.strong_dpp#c.gov_trust "Strong DPP * Gov Trust" 1.weak_dpp#c.gov_trust "Weak DPP * Gov Trust" 1.strong_kmt#c.gov_trust "Strong KMT * Gov Trust" 1.weak_kmt#c.gov_trust "Weak KMT * Gov Trust" 1.strong_other_party#c.gov_trust "Strong Other Party * Gov Trust" 1.weak_other_party#c.gov_trust "Weak Other Party * Gov Trust" _cons "Intercept") ///
 order(1.medigen_before#c.gov_trust 1.dpp#c.gov_trust 1.kmt#c.gov_trust 1.other_party#c.gov_trust 1.strong_dpp#c.gov_trust 1.weak_dpp#c.gov_trust 1.strong_kmt#c.gov_trust 1.weak_kmt#c.gov_trust 1.strong_other_party#c.gov_trust 1.weak_other_party#c.gov_trust dpp kmt other_party strong_dpp weak_dpp strong_kmt weak_kmt strong_other_party weak_other_party medigen_before gov_trust unification populism flu_vax noshot_3 male age education family_income) ///
 s(countyfe N ar2, fmt("%9.0g" "%9.0f" "%6.3f") label("County FE" "Observations" "Adjusted-R2")) ///
 drop(*.county) ///
 label compress replace

est clear






/* Figure 1 */
reg medigen_first 1.dpp#c.gov_trust 1.kmt#c.gov_trust 1.other_party#c.gov_trust 1.dpp 1.kmt 1.other_party gov_trust unification populism flu_vax noshot_1 male age education family_income i.county, vce(robust)
margins, dydx(dpp) at(gov_trust=(1(1)4)) post
est store figure_1
coefplot figure_1, ///
    at ///
    xtitle("Gov Trust", size(medium)) ///
    ytitle("Marginal Effects on Medigen First", size(3.5)) ///
    title("Marginal Effects of {bf:DPP} on {bf:Medigen First} by {bf:Gov Trust} (95% CI)", size(medium)) ///
    legend(order(2 "DPP") pos(6) rows(1)) ///
    lwidth(*1.2) ///
    lpattern(solid dash) ///
    ciopts(recast(rcap) lwidth(*0.8) lcolor(black)) ///
    yline(0, lpattern(dash) lcolor(gs8)) ///
    graphregion(color(white)) ///
    bgcolor(white) ///
    connect(l) ///
    mcolor(black) ///
    lcolor(black) ///
    msymbol(circle_hollow) ///
    msize(0.8) ///
    mlwidth(0.3)

graph export "./Out/Figure_1.png" , width(1500) height(1000) replace
est clear





/* Figure 2 */
reg medigen_first 1.strong_dpp#c.gov_trust 1.weak_dpp#c.gov_trust 1.strong_kmt#c.gov_trust 1.weak_kmt#c.gov_trust 1.strong_other_party#c.gov_trust 1.weak_other_party#c.gov_trust i.strong_dpp i.weak_dpp i.strong_kmt i.weak_kmt i.strong_other_party i.weak_other_party c.gov_trust unification populism flu_vax noshot_1 male age education family_income i.county, vce(robust)
margins, dydx(weak_dpp) at(gov_trust=(1(1)4)) post
est store figure_2
coefplot figure_2, ///
    at ///
    xtitle("Gov Trust", size(medium)) ///
    ytitle("Marginal Effects on Medigen First", size(3.5)) ///
    title("Marginal Effects of {bf:Weak DPP} on {bf:Medigen First} by {bf:Gov Trust} (95% CI)", size(medium)) ///
    legend(order(2 "Weak DPP") pos(6) rows(1)) ///
    lwidth(*1.2) ///
    lpattern(solid dash) ///
    ciopts(recast(rcap) lwidth(*0.8) lcolor(black)) ///
    yline(0, lpattern(dash) lcolor(gs8)) ///
    graphregion(color(white)) ///
    bgcolor(white) ///
    connect(l) ///
    mcolor(black) ///
    lcolor(black) ///
    msymbol(circle_hollow) ///
    msize(0.8) ///
    mlwidth(0.3)

graph export "./Out/Figure_2.png" , width(1500) height(1000) replace
est clear





/* Figure 3 */
reg medigen_booster 1.medigen_before#c.gov_trust 1.dpp#c.gov_trust 1.kmt#c.gov_trust 1.other_party#c.gov_trust i.dpp i.kmt i.other_party i.medigen_before gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
margins, dydx(dpp) at(gov_trust=(1(1)4)) post
est store figure_3_dpp

reg medigen_booster 1.medigen_before#c.gov_trust 1.dpp#c.gov_trust 1.kmt#c.gov_trust 1.other_party#c.gov_trust i.dpp i.kmt i.other_party i.medigen_before gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
margins, dydx(medigen_before) at(gov_trust=(1(1)4)) post
est store figure_3_medigen_before

coefplot (figure_3_dpp, label("DPP") offset(0.025) mcolor(black) lcolor(black) msymbol(circle_hollow) msize(0.8) mlwidth(0.3) ciopts(recast(rcap) lwidth(*0.8) lcolor(black))) ///
         (figure_3_medigen_before, label("Medigen Before") offset(-0.025) mcolor(gray) lcolor(gray) msymbol(square_hollow) msize(0.8) mlwidth(0.3) ciopts(recast(rcap) lwidth(*0.8) lcolor(gray))), ///
         at ///
         xtitle("Gov Trust", size(4)) ///
         ytitle("Marginal Effects on Medigen Booster", size(3.5)) ///
         title("Marginal Effects of {bf:Medigen Before} and {bf:DPP}" "on {bf:Medigen Booster} by {bf:Gov Trust} (95% CI)", size(medium)) ///
         legend(pos(6) rows(1)) ///
         lwidth(*1.2) ///
         lpattern(solid solid) ///
         yline(0, lpattern(dash) lcolor(gs8)) ///
         graphregion(color(white)) ///
         bgcolor(white) ///
         connect(l)

graph export "./Out/Figure_3.png" , width(1500) height(1000) replace





/* Figure 4 */
reg medigen_booster 1.medigen_before#c.gov_trust 1.strong_dpp#c.gov_trust 1.weak_dpp#c.gov_trust 1.strong_kmt#c.gov_trust 1.weak_kmt#c.gov_trust 1.strong_other_party#c.gov_trust 1.weak_other_party#c.gov_trust i.strong_dpp i.weak_dpp i.strong_kmt i.weak_kmt i.strong_other_party i.weak_other_party i.medigen_before gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
margins, dydx(weak_dpp) at(gov_trust=(1(1)4)) post
est store figure_4_weak_dpp

reg medigen_booster 1.medigen_before#c.gov_trust 1.strong_dpp#c.gov_trust 1.weak_dpp#c.gov_trust 1.strong_kmt#c.gov_trust 1.weak_kmt#c.gov_trust 1.strong_other_party#c.gov_trust 1.weak_other_party#c.gov_trust i.strong_dpp i.weak_dpp i.strong_kmt i.weak_kmt i.strong_other_party i.weak_other_party i.medigen_before gov_trust unification populism flu_vax noshot_3 male age education family_income i.county, vce(robust)
margins, dydx(medigen_before) at(gov_trust=(1(1)4)) post
est store figure_4_medigen_before

coefplot (figure_4_weak_dpp, label("Weak DPP") offset(0.025) mcolor(black) lcolor(black) msymbol(circle_hollow) msize(0.8) mlwidth(0.3) ciopts(recast(rcap) lwidth(*0.8) lcolor(black))) ///
         (figure_4_medigen_before, label("Medigen Before") offset(-0.025) mcolor(gray) lcolor(gray) msymbol(square_hollow) msize(0.8) mlwidth(0.3) ciopts(recast(rcap) lwidth(*0.8) lcolor(gray))), ///
         at ///
         xtitle("Gov Trust", size(4)) ///
         ytitle("Marginal Effects on Medigen Booster", size(3.5)) ///
         title("Marginal Effects of {bf:Medigen Before} and {bf:Weak DPP}" "on {bf:Medigen Booster} by {bf:Gov Trust} (95% CI)", size(medium)) ///
         legend(pos(6) rows(1)) ///
         lwidth(*1.2) ///
         lpattern(solid solid) ///
         yline(0, lpattern(dash) lcolor(gs8)) ///
         graphregion(color(white)) ///
         bgcolor(white) ///
         connect(l)

graph export "./Out/Figure_4.png" , width(1500) height(1000) replace
